/* ====================================================================
 * The UncleGED Open Source Software License
 *
 * Copyright (c) 1999-2003 D. M. DeBacker. All rights reserved.
 * http://gatheringleaves.org/uged
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. Products derived from this software may not be called "UncleGED",
 *    nor may "UncleGED" appear in their name, without prior written
 *    permission of D. M. DeBacker.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL D. M. DEBACKER BE LIABLE FOR ANY 
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 */

using System;
using System.Collections;
using System.Collections.Specialized;


namespace UGed
{
   //===========================
   public class Child
   {

      private string mvarFamilyID;
      private string mvarChildID;


      public string ChildID
      {
         get
         {
            return mvarChildID;
         }
         set
         {
            mvarChildID = value;
         }
      }


      public string FamilyID
      {
         get
         {
            return mvarFamilyID;
         }
         set
         {
            mvarFamilyID = value;
         }
      }

   }


   //===========================
   public class Family
   {

      private string mvarID = "";
      private string mvarHusband = "";
      private string mvarWife = "";
      private string mvarMarriageDateText = "";
      private string mvarMarriagePlace = "";
      private string mvarDivorcePlace = "";
      private string mvarDivorceDateText = "";
      private LifeEvents mvarLifeEvents = new LifeEvents();
      private Sources mvarSources = new Sources();
      private bool mvarHasChildren = false;
      private string mvarNotes = "";
      private string mvarReferenceNumber = "";
      private DateTime mvarLastChangeDate;

      public Family()
      {
         mvarID = "";
         mvarHusband = "";
         mvarWife = "";
         mvarMarriageDateText = "";
         mvarMarriagePlace = "";
         mvarDivorcePlace = "";
         mvarDivorceDateText = "";
         mvarLifeEvents = new LifeEvents();
         mvarSources = new Sources();
         mvarHasChildren = false;
         mvarNotes = "";
         mvarReferenceNumber = "";
         DateTime mvarLastChangeDate = new DateTime();
      }


      public DateTime LastChangeDate
      {
         get
         {
            return mvarLastChangeDate;
         }
         set
         {
            mvarLastChangeDate = value;
         }
      }


      public string ReferenceNumber
      {
         get
         {
            return mvarReferenceNumber;
         }
         set
         {
            mvarReferenceNumber = value;
         }
      }


      public string Notes
      {
         get
         {
            return mvarNotes;
         }
         set
         {
            mvarNotes = value;
         }
      }



      public bool HasChildren
      {
         get
         {
            return mvarHasChildren;
         }
         set
         {
            mvarHasChildren = value;
         }
      }



      public Sources Sources
      {
         get
         {

            return mvarSources;
         }
         set
         {
            mvarSources = value;
         }
      }

      public LifeEvents LifeEvents
      {
         get
         {

            return mvarLifeEvents;
         }
         set
         {
            mvarLifeEvents = value;
         }
      }

      public string DivorceDateText
      {
         get
         {
            return mvarDivorceDateText;
         }
         set
         {
            mvarDivorceDateText = value;
         }
      }


      public string DivorcePlace
      {
         get
         {
            return mvarDivorcePlace;
         }
         set
         {
            mvarDivorcePlace = value;
         }
      }


      public string MarriagePlace
      {
         get
         {
            return mvarMarriagePlace;
         }
         set
         {
            mvarMarriagePlace = value;
         }
      }


      public string MarriageDateText
      {
         get
         {
            return mvarMarriageDateText;
         }
         set
         {
            mvarMarriageDateText = value;
         }
      }


      public string Wife
      {
         get
         {
            return mvarWife;
         }
         set
         {
            mvarWife = value;
         }
      }


      public string Husband
      {
         get
         {
            return mvarHusband;
         }
         set
         {
            mvarHusband = value;
         }
      }


      public string ID
      {
         get
         {
            return mvarID;
         }
         set
         {
            mvarID = value;
         }
      }

   }


   //============================
   public class FileInfo
   {

      private string mvarSource;
      private string mvarSourceName;
      private string mvarVersion;
      private string mvarCreationDate;
      private string mvarCreationTime;
      private string mvarSourceFile;
      private string mvarSubmitterName;
      private string mvarSubmitterEmail;


      public string SubmitterEmail
      {
         get
         {
            return (mvarSubmitterEmail);
         }
         set
         {
            mvarSubmitterEmail = value;
         }
      }


      public string SubmitterName
      {
         get
         {
            return (mvarSubmitterName);
         }
         set
         {
            mvarSubmitterName = value;
         }
      }


      public string SourceFile
      {
         get
         {
            return (mvarSourceFile);
         }
         set
         {
            mvarSourceFile = value;
         }
      }


      public string CreationTime
      {
         get
         {
            return (mvarCreationTime);
         }
         set
         {
            mvarCreationTime = value;
         }
      }


      public string CreationDate
      {
         get
         {
            return (mvarCreationDate);
         }
         set
         {
            mvarCreationDate = value;
         }
      }


      public string Version
      {
         get
         {
            return mvarVersion;
         }
         set
         {
            mvarVersion = value;
         }
      }


      public string SourceName
      {
         get
         {
            return mvarSourceName;
         }
         set
         {
            mvarSourceName = value;
         }
      }


      public string Source
      {
         get
         {
            return mvarSource;
         }
         set
         {
            mvarSource = value;
         }
      }
   }


   //============================
   public class Individual
   {

      private string mvarSurname = "";
      private string mvarForenames = "";
      private string mvarSex = "";
      private string mvarBirthDateText = "";
      private string mvarBirthPlace = "";
      private string mvarBaptismDateText = "";
      private string mvarBaptismPlace = "";
      private string mvarDeathDateText = "";
      private string mvarBurialDateText = "";
      private string mvarDeathPlace = "";
      private string mvarAddress = "";
      private string mvarReferenceNumber = "";
      private string mvarNotes = "";
      private string mvarID = "";
      private string mvarBurialPlace = "";
      private string mvarAliasName = "";
      private string mvarNationality = "";
      private string mvarSuffix = "";
      private LifeEvents mvarLifeEvents = new LifeEvents();
      private Sources mvarSources = new Sources();
      private string mvarFamilyID = "";
      private bool mvarHasOwnFamily = false;
      private string mvarLinkPage = "";
      private DateTime mvarLastChangeDate;
      private FamList mvarFamList = new FamList();
      private int mvarMinBirthYear;
      private int mvarMaxBirthYear;
      private bool mvarDidEstimate;
      private string mvarPafUniqueID = "";
      private int mvarLineNumber;


      public Individual()
      {

         mvarSurname = "";
         mvarForenames = "";
         mvarSex = "";
         mvarBirthDateText = "";
         mvarBirthPlace = "";
         mvarBaptismDateText = "";
         mvarBaptismPlace = "";
         mvarDeathDateText = "";
         mvarBurialDateText = "";
         mvarDeathPlace = "";
         mvarAddress = "";
         mvarReferenceNumber = "";
         mvarNotes = "";
         mvarID = "";
         mvarBurialPlace = "";
         mvarAliasName = "";
         mvarNationality = "";
         mvarSuffix = "";
         mvarHasOwnFamily = false;
         mvarMinBirthYear = 1300;
         mvarMaxBirthYear = DateTime.Now.Year;
         mvarFamilyID = "";

      }

      public int LineNumber
      {
         get
         {
            return mvarLineNumber;
         }
         set
         {
            mvarLineNumber = value;
         }
      }

      public string PafUniqueID
      {
         get
         {
            return mvarPafUniqueID;
         }
         set
         {
            mvarPafUniqueID = value;
         }
      }

      public bool DidEstimate
      {
         get
         {
            return mvarDidEstimate;
         }
         set
         {
            mvarDidEstimate = value;
         }
      }

      public int MinBirthYear
      {
         get
         {
            return mvarMinBirthYear;
         }
         set
         {
            mvarMinBirthYear = value;
         }
      }

      public int MaxBirthYear
      {
         get
         {
            return mvarMaxBirthYear;
         }
         set
         {
            mvarMaxBirthYear = value;
         }
      }

      public FamList FamList
      {
         get
         {
            return mvarFamList;
         }
         set
         {
            mvarFamList = value;
         }
      }

      public DateTime LastChangeDate
      {
         get
         {
            return mvarLastChangeDate;
         }
         set
         {
            mvarLastChangeDate = value;
         }
      }


      public string LinkPage
      {
         get
         {
            return mvarLinkPage;
         }
         set
         {
            mvarLinkPage = value;
         }
      }


      public bool HasOwnFamily
      {
         get
         {
            return mvarHasOwnFamily;
         }
         set
         {
            mvarHasOwnFamily = value;
         }
      }


      public string FamilyID
      {
         get
         {
            return mvarFamilyID;
         }
         set
         {
            mvarFamilyID = value;
         }
      }


      public Sources Sources
      {
         get
         {
            return mvarSources;
         }
         set
         {
            mvarSources = value;
         }
      }


      public LifeEvents LifeEvents
      {
         get
         {
            return mvarLifeEvents;
         }
         set
         {
            mvarLifeEvents = value;
         }
      }


      public string Suffix
      {
         get
         {
            return mvarSuffix;
         }
         set
         {
            mvarSuffix = value;
         }
      }


      public string Nationality
      {
         get
         {
            return mvarNationality;
         }
         set
         {
            mvarNationality = value;
         }
      }


      public string AliasName
      {
         get
         {
            return mvarAliasName;
         }
         set
         {
            mvarAliasName = value;
         }
      }


      public string BurialPlace
      {
         get
         {
            return mvarBurialPlace;
         }
         set
         {
            mvarBurialPlace = value;
         }
      }


      public string ID
      {
         get
         {
            return mvarID;
         }
         set
         {
            mvarID = value;
         }
      }


      public string Notes
      {
         get
         {
            return mvarNotes;
         }
         set
         {
            mvarNotes = value;
         }
      }


      public string ReferenceNumber
      {
         get
         {
            return mvarReferenceNumber;
         }
         set
         {
            mvarReferenceNumber = value;
         }
      }


      public string Address
      {
         get
         {
            return mvarAddress;
         }
         set
         {
            mvarAddress = value;
         }
      }


      public string DeathPlace
      {
         get
         {
            return mvarDeathPlace;
         }
         set
         {
            mvarDeathPlace = value;
         }
      }


      public string BurialDateText
      {
         get
         {
            return mvarBurialDateText;
         }
         set
         {
            mvarBurialDateText = value;
         }
      }


      public string DeathDateText
      {
         get
         {
            return mvarDeathDateText;
         }
         set
         {
            mvarDeathDateText = value;
         }
      }


      public string BaptismPlace
      {
         get
         {
            return mvarBaptismPlace;
         }
         set
         {
            mvarBaptismPlace = value;
         }
      }


      public string BaptismDateText
      {
         get
         {
            return mvarBaptismDateText;
         }
         set
         {
            mvarBaptismDateText = value;
         }
      }


      public string BirthPlace
      {
         get
         {
            return mvarBirthPlace;
         }
         set
         {
            mvarBirthPlace = value;
         }
      }


      public string BirthDateText
      {
         get
         {
            return mvarBirthDateText;
         }
         set
         {
            mvarBirthDateText = value;
         }
      }


      public string Sex
      {
         get
         {
            return mvarSex;
         }
         set
         {
            mvarSex = value;
         }
      }


      public string Forenames
      {
         get
         {
            return mvarForenames;
         }
         set
         {
            mvarForenames = value;
         }
      }


      public string Surname
      {
         get
         {
            return mvarSurname;
         }
         set
         {
            mvarSurname = value;
         }
      }
   }


   //============================
   public class LifeEvent
   {

      public enum EventTypes
      {
         etUnknown = 0,
         etBirth,
         etBaptism,
         etDeath,
         etBurial,
         etOccupation,
         etMarriage,
         etResidence,
         etImmigration,
         etMilitary,
         etDeathOfSpouse,
         etDivorce,
         etOther,
         etNationality,
         etElected,
         etExcommunicated,
         etMission,
         etBaptismLDS,
         etBar_Mitzvah,
         etBat_Mitzvah,
         etBlessing,
         etCaste,
         etCensus,
         etChristening,
         etConfirmation,
         etConfirmationLDS,
         etCremation,
         etEducation,
         etEmigration,
         etEndowmentLDS,
         etFirstCommunion,
         etGraduation,
         etNaturalization,
         etOrdination,
         etProbate,
         etProperty,
         etReligion,
         etRetirement,
         etSealedToParentsLDS,
         etSSN,
         etWill,
         etChange,
      };

      private EventTypes mvarEventType;
      private string mvarEventDateString;
      private string mvarEventPlace;
      private string mvarID;
      private string mvarEventText;
      private string mvarEventNote;
      private string mvarEventDescription;


      public string EventDescription
      {
         get
         {
            return mvarEventDescription;
         }
         set
         {
            mvarEventDescription = value;
         }
      }

      public string EventNote
      {
         get
         {
            return mvarEventNote;
         }
         set
         {
            mvarEventNote = value;
         }
      }


      public string EventText
      {
         get
         {
            return mvarEventText;
         }
         set
         {
            mvarEventText = value;
         }
      }


      public string ID
      {
         get
         {
            return mvarID;
         }
         set
         {
            mvarID = value;
         }
      }


      public string EventPlace
      {
         get
         {
            return mvarEventPlace;
         }
         set
         {
            mvarEventPlace = value;
         }
      }


      public string EventDateString
      {
         get
         {
            return mvarEventDateString;
         }
         set
         {
            mvarEventDateString = value;
         }
      }


      public EventTypes EventType
      {
         get
         {
            return mvarEventType;
         }
         set
         {
            mvarEventType = value;
         }
      }
   }


   //============================
   public class Location
   {

      private string mvarLocationName;
      private string mvarPersonName;
      private LifeEvent.EventTypes mvarEventType;


      public LifeEvent.EventTypes EventType
      {
         get
         {
            return mvarEventType;
         }
         set
         {
            mvarEventType = value;
         }
      }


      public string PersonName
      {
         get
         {
            return mvarPersonName;
         }
         set
         {
            mvarPersonName = value;
         }
      }


      public string LocationName
      {
         get
         {
            return mvarLocationName;
         }
         set
         {
            mvarLocationName = value;
         }
      }
   }


   //============================
   public class Note
   {

      private string mvarID;
      private string mvarNoteText;

      public Note()
      {
         mvarID = "";
         mvarNoteText = "";
      }

      public string NoteText
      {
         get
         {
            return mvarNoteText;
         }
         set
         {
            mvarNoteText = value;
         }
      }

      public string ID
      {
         get
         {
            return mvarID;
         }
         set
         {
            mvarID = value;
         }
      }
   }


   //============================
   public class Occupation
   {

      private string mvarOccupationTitle;
      private string mvarPersonName;
      private int mvarOrigIndex;


      public string PersonName
      {
         get
         {
            return mvarPersonName;
         }
         set
         {
            mvarPersonName = value;
         }
      }

      public string OccupationTitle
      {
         get
         {
            return mvarOccupationTitle;
         }
         set
         {
            mvarOccupationTitle = value;
         }
      }

      public int OrigIndex
      {
         get
         {
            return mvarOrigIndex;
         }
         set
         {
            mvarOrigIndex = value;
         }
      }

   }


   //============================
   public class Source
   {

      private string mvarID;
      private string mvarTitle;
      private string mvarSourceText;
      private string mvarPublicationInfo;
      private string mvarAuthor;
      private string mvarMedia;
      private string mvarNote;
      private string mvarPage;
      private string mvarEventTag;
      private string mvarAbbreviation;


      public string Abbreviation
      {
         get
         {
            return mvarAbbreviation;
         }
         set
         {
            mvarAbbreviation = value;
         }
      }


      public string EventTag
      {
         get
         {
            return mvarEventTag;
         }
         set
         {
            mvarEventTag = value;
         }
      }


      public string Page
      {
         get
         {
            return mvarPage;
         }
         set
         {
            mvarPage = value;
         }
      }


      public string Note
      {
         get
         {
            return mvarNote;
         }
         set
         {
            mvarNote = value;
         }
      }


      public string Media
      {
         get
         {
            return mvarMedia;
         }
         set
         {
            mvarMedia = value;
         }
      }


      public string Author
      {
         get
         {
            return mvarAuthor;
         }
         set
         {
            mvarAuthor = value;
         }
      }


      public string PublicationInfo
      {
         get
         {
            return mvarPublicationInfo;
         }
         set
         {
            mvarPublicationInfo = value;
         }
      }


      public string SourceText
      {
         get
         {
            return mvarSourceText;
         }
         set
         {
            mvarSourceText = value;
         }
      }


      public string Title
      {
         get
         {
            return mvarTitle;
         }
         set
         {
            mvarTitle = value;
         }
      }


      public string ID
      {
         get
         {
            return mvarID;
         }
         set
         {
            mvarID = value;
         }
      }
   }


   //============================
   public class Surname
   {

      private string mvarFamilyName;
      private string mvarFirstLink;
      private int mvarNumItems;

      public Surname()
      {
         mvarFamilyName = "";
         mvarFirstLink = "";
         mvarNumItems = 1;
      }


      public int NumItems
      {
         get
         {
            return mvarNumItems;
         }
         set
         {
            mvarNumItems = value;
         }
      }


      public string FirstLink
      {
         get
         {
            return mvarFirstLink;
         }
         set
         {
            mvarFirstLink = value;
         }
      }


      public string FamilyName
      {
         get
         {
            return mvarFamilyName;
         }
         set
         {
            mvarFamilyName = value;
         }
      }

   }



   #region Collection Classes

   //============================================
   public class Children : System.Collections.Specialized.NameObjectCollectionBase
   {

      Hashtable ht = new Hashtable();

      public bool Add(Child NewChild)
      {

         string key;

         try
         {
            //the key is formed by conc the fam id and the child id
            key = NewChild.FamilyID + NewChild.ChildID;
            ht.Add(key, null); //will fail if duplicate key 	
            this.BaseAdd(key, NewChild);
            return true;
         }
         catch
         {
            return false;
         }
      }


      public void Clear()
      {
         this.BaseClear();
      }

      // the Remove method that takes a string key
      public void Remove(string key)
      {
         this.Remove(key);
      }

      // the Remove method that takes a numeric index
      public void Remove(int index)
      {
         this.Remove(index);
      }

      // the Item property that takes a string key
      public Child this[string key]
      {
         get { return (Child)this.BaseGet(key); }
         set { this.BaseSet(key, value); }
      }

      // the Item property that takes a numeric index
      public Child this[int index]
      {
         get { return (Child)this.BaseGet(index); }
         set { this.BaseSet(index, value); }
      }

      public new IEnumerator GetEnumerator()
      {
         // return an instance of the inner enumerator object
         return new myEnumerator(this);
      }

      private class myEnumerator : IEnumerator
      {
         // a reference to the parent object
         Children parent;
         Child currObject;
         int index = 0;

         public myEnumerator(Children fc)
         {
            this.parent = fc;
         }

         // the IEnumerator interface (three methods)

         public bool MoveNext()
         {
            if (index < parent.Count)
            {
               currObject = parent[index];
               index++;
               return true;
            }
            else
            {
               index = 0;
               return false;
            }
         }

         public object Current
         {
            get
            {
               // just return the line read by MoveNext
               return currObject;
            }
         }

         public void Reset()
         {
            // this method is never called and can be left empty
         }
      }

   }


   //============================================
   public class Families : System.Collections.Specialized.NameObjectCollectionBase
   {

      Hashtable ht = new Hashtable();

      public bool Add(Family NewFamily)
      {
         string key;

         try
         {
            key = NewFamily.ID;
            //attempt to add key to hashtable. this will fail if key is already in table
            ht.Add(key, null); //will fail if duplicate key 	
            this.BaseAdd(key, NewFamily);
            return true;
         }
         catch
         {
            return false;
         }

      }

      public void Clear()
      {
         this.BaseClear();
      }

      // the Remove method that takes a string key
      public void Remove(string key)
      {
         this.Remove(key);
      }

      // the Remove method that takes a numeric index
      public void Remove(int index)
      {
         this.Remove(index);
      }

      // the Item property that takes a string key
      public Family this[string key]
      {
         get { return (Family)this.BaseGet(key); }
         set { this.BaseSet(key, value); }
      }

      // the Item property that takes a numeric index
      public Family this[int index]
      {
         get { return (Family)this.BaseGet(index); }
         set { this.BaseSet(index, value); }
      }


      public new IEnumerator GetEnumerator()
      {
         // return an instance of the inner enumerator object
         return new myEnumerator(this);
      }

      private class myEnumerator : IEnumerator
      {
         // a reference to the parent object
         Families parent;
         Family currObject;
         int index = 0;

         public myEnumerator(Families fc)
         {
            this.parent = fc;
         }

         // the IEnumerator interface (three methods)

         public bool MoveNext()
         {
            if (index < parent.Count)
            {
               currObject = parent[index];
               index++;
               return true;
            }
            else
            {
               index = 0;
               return false;
            }
         }

         public object Current
         {
            get
            {
               // just return the line read by MoveNext
               return currObject;
            }
         }

         public void Reset()
         {
            // this method is never called and can be left empty
         }
      }

   }


   //============================================
   public class Individuals : System.Collections.Specialized.NameObjectCollectionBase
   {
      Hashtable ht = new Hashtable();

      public bool Add(Individual NewIndividual)
      {
         string key;
         try
         {
            key = NewIndividual.ID;
            ht.Add(key, null); //will fail if duplicate key 	
            this.BaseAdd(key, NewIndividual);
            return true;
         }
         catch
         {
            return false;
         }
      }

      public void Clear()
      {
         this.BaseClear();
      }

      // the Remove method that takes a string key
      public void Remove(string key)
      {
         this.Remove(key);
      }

      // the Remove method that takes a numeric index
      public void Remove(int index)
      {
         this.Remove(index);
      }

      // the Item property that takes a string key
      public Individual this[string key]
      {
         get { return (Individual)this.BaseGet(key); }
         set { this.BaseSet(key, value); }
      }

      // the Item property that takes a numeric index
      public Individual this[int index]
      {
         get { return (Individual)this.BaseGet(index); }
         set { this.BaseSet(index, value); }
      }

      public new IEnumerator GetEnumerator()
      {
         // return an instance of the inner enumerator object
         return new myEnumerator(this);
      }

      private class myEnumerator : IEnumerator
      {
         // a reference to the parent object
         Individuals parent;
         Individual currObject;
         int index = 0;

         public myEnumerator(Individuals fc)
         {
            this.parent = fc;
         }

         // the IEnumerator interface (three methods)

         public bool MoveNext()
         {
            if (index < parent.Count)
            {
               currObject = parent[index];
               index++;
               return true;
            }
            else
            {
               index = 0;
               return false;
            }
         }

         public object Current
         {
            get
            {
               // just return the line read by MoveNext
               return currObject;
            }
         }

         public void Reset()
         {
            // this method is never called and can be left empty
         }
      }

   }


   //============================================
   public class LifeEvents : System.Collections.Specialized.NameObjectCollectionBase
   {

      Hashtable ht = new Hashtable();

      public bool Add(LifeEvent NewEvent)
      {

         try
         {
            string key;
            key = NewEvent.ID;
            ht.Add(key, null); //will fail if duplicate key 	
            this.BaseAdd(key, NewEvent);
            return true;
         }
         catch
         {
            return false;
         }
      }


      public void Clear()
      {
         this.BaseClear();
      }

      // the Remove method that takes a string key
      public void Remove(string key)
      {
         this.Remove(key);
      }

      // the Remove method that takes a numeric index
      public void Remove(int index)
      {
         this.Remove(index);
      }

      // the Item property that takes a string key
      public LifeEvent this[string key]
      {
         get { return (LifeEvent)this.BaseGet(key); }
         set { this.BaseSet(key, value); }
      }

      // the Item property that takes a numeric index
      public LifeEvent this[int index]
      {
         get { return (LifeEvent)this.BaseGet(index); }
         set { this.BaseSet(index, value); }
      }

      public new IEnumerator GetEnumerator()
      {
         // return an instance of the inner enumerator object
         return new myEnumerator(this);
      }

      private class myEnumerator : IEnumerator
      {
         // a reference to the parent object
         LifeEvents parent;
         LifeEvent currObject;
         int index = 0;

         public myEnumerator(LifeEvents fc)
         {
            this.parent = fc;
         }

         // the IEnumerator interface (three methods)

         public bool MoveNext()
         {
            if (index < parent.Count)
            {
               currObject = parent[index];
               index++;
               return true;
            }
            else
            {
               index = 0;
               return false;
            }
         }

         public object Current
         {
            get
            {
               // just return the line read by MoveNext
               return currObject;
            }
         }

         public void Reset()
         {
            // this method is never called and can be left empty
         }
      }

   }


   //============================================
   public class Locations : System.Collections.Specialized.NameObjectCollectionBase
   {

      Hashtable ht = new Hashtable();

      public bool Add(string LocationName, string PersonName, LifeEvent.EventTypes EventType, string key)
      {

         //create a new object
         Location objNewMember = new Location();

         try
         {
            //set the properties passed into the method
            objNewMember.LocationName = LocationName;
            objNewMember.PersonName = PersonName;
            objNewMember.EventType = EventType;

            ht.Add(key, null); //will fail if duplicate key 	
            this.BaseAdd(key, objNewMember);

            return true;
         }
         catch
         {
            return false;
         }
      }


      public void DumpHt()
      {
         ht.Clear();
      }

      public void Clear()
      {
         this.BaseClear();
      }

      // the Remove method that takes a string key
      public void Remove(string key)
      {
         this.Remove(key);
      }

      // the Remove method that takes a numeric index
      public void Remove(int index)
      {
         this.Remove(index);
      }

      // the Item property that takes a string key
      public Location this[string key]
      {
         get { return (Location)this.BaseGet(key); }
         set { this.BaseSet(key, value); }
      }

      // the Item property that takes a numeric index
      public Location this[int index]
      {
         get { return (Location)this.BaseGet(index); }
         set { this.BaseSet(index, value); }
      }

      public new IEnumerator GetEnumerator()
      {
         // return an instance of the inner enumerator object
         return new myEnumerator(this);
      }

      private class myEnumerator : IEnumerator
      {
         // a reference to the parent object
         Locations parent;
         Location currObject;
         int index = 0;

         public myEnumerator(Locations fc)
         {
            this.parent = fc;
         }

         // the IEnumerator interface (three methods)

         public bool MoveNext()
         {
            if (index < parent.Count)
            {
               currObject = parent[index];
               index++;
               return true;
            }
            else
            {
               index = 0;
               return false;
            }
         }

         public object Current
         {
            get
            {
               // just return the line read by MoveNext
               return currObject;
            }
         }

         public void Reset()
         {
            // this method is never called and can be left empty
         }
      }

   }


   //============================================
   public class Notes : System.Collections.Specialized.NameObjectCollectionBase
   {

      Hashtable ht = new Hashtable();

      public bool Add(Note NewNote)
      {
         string key;

         try
         {
            key = NewNote.ID;
            ht.Add(key, null); //will fail if duplicate key 	
            this.BaseAdd(key, NewNote);
            return true;
         }
         catch
         {
            return false;
         }
      }

      public void Clear()
      {
         this.BaseClear();
      }

      // the Remove method that takes a string key
      public void Remove(string key)
      {
         this.Remove(key);
      }

      // the Remove method that takes a numeric index
      public void Remove(int index)
      {
         this.Remove(index);
      }

      // the Item property that takes a string key
      public Note this[string key]
      {
         get { return (Note)this.BaseGet(key); }
         set { this.BaseSet(key, value); }
      }

      // the Item property that takes a numeric index
      public Note this[int index]
      {
         get { return (Note)this.BaseGet(index); }
         set { this.BaseSet(index, value); }
      }

      public new IEnumerator GetEnumerator()
      {
         // return an instance of the inner enumerator object
         return new myEnumerator(this);
      }

      private class myEnumerator : IEnumerator
      {
         // a reference to the parent object
         Notes parent;
         Note currObject;
         int index = 0;

         public myEnumerator(Notes fc)
         {
            this.parent = fc;
         }

         // the IEnumerator interface (three methods)

         public bool MoveNext()
         {
            if (index < parent.Count)
            {
               currObject = parent[index];
               index++;
               return true;
            }
            else
            {
               index = 0;
               return false;
            }
         }

         public object Current
         {
            get
            {
               // just return the line read by MoveNext
               return currObject;
            }
         }

         public void Reset()
         {
            // this method is never called and can be left empty
         }
      }

   }


   //============================================
   public class Occupations : System.Collections.Specialized.NameObjectCollectionBase
   {

      Hashtable ht = new Hashtable();

      public Occupation Add(string OccupationTitle, string PersonName, string key)
      {
         //create a new object
         Occupation o = new Occupation();

         try
         {
            //set the properties passed into the method
            o.OccupationTitle = OccupationTitle;
            o.PersonName = PersonName;
            ht.Add(key, null); //will fail if duplicate key 	
            this.BaseAdd(key, o);

            //return the object created
            return o;
         }
         catch
         {
            return null;
         }
      }

      public void Clear()
      {
         this.BaseClear();
      }

      // the Remove method that takes a string key
      public void Remove(string key)
      {
         this.Remove(key);
      }

      // the Remove method that takes a numeric index
      public void Remove(int index)
      {
         this.Remove(index);
      }

      // the Item property that takes a string key
      public Occupation this[string key]
      {
         get { return (Occupation)this.BaseGet(key); }
         set { this.BaseSet(key, value); }
      }

      // the Item property that takes a numeric index
      public Occupation this[int index]
      {
         get { return (Occupation)this.BaseGet(index); }
         set { this.BaseSet(index, value); }
      }

      public new IEnumerator GetEnumerator()
      {
         // return an instance of the inner enumerator object
         return new myEnumerator(this);
      }

      private class myEnumerator : IEnumerator
      {
         // a reference to the parent object
         Occupations parent;
         Occupation currObject;
         int index = 0;

         public myEnumerator(Occupations fc)
         {
            this.parent = fc;
         }

         // the IEnumerator interface (three methods)

         public bool MoveNext()
         {
            if (index < parent.Count)
            {
               currObject = parent[index];
               index++;
               return true;
            }
            else
            {
               index = 0;
               return false;
            }
         }

         public object Current
         {
            get
            {
               // just return the line read by MoveNext
               return currObject;
            }
         }

         public void Reset()
         {
            // this method is never called and can be left empty
         }
      }

   }


   //============================================
   public class Sources : System.Collections.Specialized.NameObjectCollectionBase
   {

      Hashtable ht = new Hashtable();

      public bool Add(Source NewSource)
      {
         string key;
         try
         {
            key = NewSource.ID;
            ht.Add(key, null); //will fail if duplicate key 	
            this.BaseAdd(key, NewSource);
            return true;
         }
         catch
         {
            return false;
         }
      }

      public void Clear()
      {
         this.BaseClear();
      }

      // the Remove method that takes a string key
      public void Remove(string key)
      {
         this.Remove(key);
      }

      // the Remove method that takes a numeric index
      public void Remove(int index)
      {
         this.Remove(index);
      }

      // the Item property that takes a string key
      public Source this[string key]
      {
         get { return (Source)this.BaseGet(key); }
         set { this.BaseSet(key, value); }
      }

      // the Item property that takes a numeric index
      public Source this[int index]
      {
         get { return (Source)this.BaseGet(index); }
         set { this.BaseSet(index, value); }
      }

      public new IEnumerator GetEnumerator()
      {
         // return an instance of the inner enumerator object
         return new myEnumerator(this);
      }

      private class myEnumerator : IEnumerator
      {
         // a reference to the parent object
         Sources parent;
         Source currObject;
         int index = 0;

         public myEnumerator(Sources fc)
         {
            this.parent = fc;
         }

         // the IEnumerator interface (three methods)

         public bool MoveNext()
         {
            if (index < parent.Count)
            {
               currObject = parent[index];
               index++;
               return true;
            }
            else
            {
               index = 0;
               return false;
            }
         }

         public object Current
         {
            get
            {
               // just return the line read by MoveNext
               return currObject;
            }
         }

         public void Reset()
         {
            // this method is never called and can be left empty
         }
      }

   }


   //============================================
   public class Surnames : System.Collections.Specialized.NameObjectCollectionBase
   {

      Hashtable ht = new Hashtable();

      public bool Add(Surname NewSurname)
      {
         string key;
         try
         {
            key = NewSurname.FamilyName;
            ht.Add(key, null); //will fail if duplicate key 	
            this.BaseAdd(key, NewSurname);
            return true;
         }
         catch
         {
            return false;
         }
      }


      public void Clear()
      {
         this.BaseClear();
      }

      // the Remove method that takes a string key
      public void Remove(string key)
      {
         this.Remove(key);
      }

      // the Remove method that takes a numeric index
      public void Remove(int index)
      {
         this.Remove(index);
      }

      // the Item property that takes a string key
      public Surname this[string key]
      {
         get { return (Surname)this.BaseGet(key); }
         set { this.BaseSet(key, value); }
      }

      // the Item property that takes a numeric index
      public Surname this[int index]
      {
         get { return (Surname)this.BaseGet(index); }
         set { this.BaseSet(index, value); }
      }
      public new IEnumerator GetEnumerator()
      {
         // return an instance of the inner enumerator object
         return new myEnumerator(this);
      }

      private class myEnumerator : IEnumerator
      {
         // a reference to the parent object
         Surnames parent;
         Surname currObject;
         int index = 0;

         public myEnumerator(Surnames fc)
         {
            this.parent = fc;
         }

         // the IEnumerator interface (three methods)

         public bool MoveNext()
         {
            if (index < parent.Count)
            {
               currObject = parent[index];
               index++;
               return true;
            }
            else
            {
               index = 0;
               return false;
            }
         }

         public object Current
         {
            get
            {
               // just return the line read by MoveNext
               return currObject;
            }
         }

         public void Reset()
         {
            // this method is never called and can be left empty
         }
      }


   }


   #endregion
}
